<!DOCTYPE html>
<html>

<head>
    <include file="public@head" title="上传设置" keywords="后台管理系统"/>
</head>

<body class="layui-layout-admin">
<include file="public@header"/>
<include file="public@side"/>

<div class="layui-body">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a href="{:url('admin/index/index')}">主页</a>
        <a>系统设置</a>
        <a href="{:url('admin/mailer/index')}"><cite>上传设置</cite></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form pdt10" action="{:url('admin/setting/uploadSetting')}" method="post">
                <div class="layui-form-item">
                    <label class="layui-form-label">最大同时上传文件数</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input input-large" name="max_files" title="最大同时上传文件数"
                               placeholder="最大同时上传文件数" value="{$max_files|default=20}">
                    </div>
                    <div class="layui-word-aux">多文件上传时,用户能最大同时上传文件数,默认20个</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">文件分块上传分块大小</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input input-large" name="chunk_size"
                               title="文件分块上传分块大小KB,1M=1024KB" placeholder="文件分块上传分块大小KB,1M=1024KB"
                               value="{$chunk_size|default=512}">
                    </div>
                    <div class="layui-word-aux">文件上传采用分块上传,文件分块大小默认512KB,可以根据服务器最大上传限制设置此数值</div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">图片文件</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-large"
                                   name="file_types[image][upload_max_filesize]" title="允许上传大小KB,1M=1024KB"
                                   placeholder="允许上传大小KB,1M=1024KB"
                                   value="{$file_types.image.upload_max_filesize|default=10240}">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-xlarge" name="file_types[image][extensions]"
                                   title="扩展名,以英文逗号分隔" placeholder="扩展名,以英文逗号分隔"
                                   value="{$file_types.image.extensions|default='jpg,jpeg,png,gif,bmp'}">
                        </div>
                    </div>
                    <div class="layui-word-aux">允许上传大小默认为10240KB,1M=1024KB，允许上传格式默认为jpg,jpeg,png,gif,bmp</div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">视频文件</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-large"
                                   name="file_types[video][upload_max_filesize]" title="允许上传大小KB,1M=1024KB"
                                   placeholder="允许上传大小KB,1M=1024KB"
                                   value="{$file_types.video.upload_max_filesize|default=10240}">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-xlarge" name="file_types[video][extensions]"
                                   title="扩展名,以英文逗号分隔" placeholder="扩展名,以英文逗号分隔"
                                   value="{$file_types.video.extensions|default='mp4,avi,wmv,rm,rmvb,mkv'}">
                        </div>
                    </div>
                    <div class="layui-word-aux">允许上传大小默认为102400KB,1M=1024KB，允许上传格式默认为mp4,avi,wmv,rm,rmvb,mkv</div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">音频文件</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-large"
                                   name="file_types[audio][upload_max_filesize]" title="允许上传大小KB,1M=1024KB"
                                   placeholder="允许上传大小KB,1M=1024KB"
                                   value="{$file_types.audio.upload_max_filesize|default=10240}">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-xlarge" name="file_types[audio][extensions]"
                                   title="扩展名,以英文逗号分隔" placeholder="扩展名,以英文逗号分隔"
                                   value="{$file_types.audio.extensions|default='mp3,wma,wav'}">
                        </div>
                    </div>
                    <div class="layui-word-aux">允许上传大小默认为10240KB,1M=1024KB，允许上传格式默认为mp3,wma,wav</div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">附件</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-large"
                                   name="file_types[file][upload_max_filesize]" title="允许上传大小KB,1M=1024KB"
                                   placeholder="允许上传大小KB,1M=1024KB"
                                   value="{$file_types.file.upload_max_filesize|default=10240}">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input input-xlarge" name="file_types[file][extensions]"
                                   title="扩展名,以英文逗号分隔" placeholder="扩展名,以英文逗号分隔"
                                   value="{$file_types.file.extensions|default='txt,pdf,doc,docx,xls,xlsx,ppt,pptx,zip,rar'}">
                        </div>
                        <div class="layui-word-aux">
                            允许上传大小默认为10240KB,1M=1024KB，允许上传格式默认为除以上文档类型以外的其它常用文件,如：txt,pdf,doc,docx,xls,xlsx,ppt,pptx,zip,rar
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="save">保存修改
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="__STATIC__/layui/layui.js"></script>
<script>
    layui.use(['element', 'form', 'jquery'], function () {
        var element = layui.element,
            form = layui.form,
            $ = layui.jquery;
        form.on('submit(save)', function (data) {
            $.post(data.action, data.field, function (res) {
                if (res.url) { //如果返回值有需要跳转的url则跳转，否则重载当前页面
                    window.location.href = res.url;
                } else {
                    window.location.reload();
                }
            });
            return false;
        });
    });
</script>
</body>

</html>
